
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main_list.xhtml">

 		<ui:param name="resultList" value="#{boletimMedicaoListMB.resultList}"/>
 	<ui:param name="tituloLista" value="#{messages['boletimMedicao.list.table.title']}"/>
 	

	<ui:define name="botoes">
					<p:commandButton title="#{messages['button.new']}" icon="ui-icon-document" action="#{boletimMedicaoListMB.getNextView}"
						actionListener="#{boletimMedicaoListMB.clear}" ajax="false" />

					<p:commandButton title="#{messages['button.delete']}" icon="ui-icon-trash" onclick="confirmation.show()"
						type="button" immediate="true" ajax="false" />

					<p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.alert']}!" severity="alert" widgetVar="confirmation">

						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{boletimMedicaoListMB.deleteSelection}"
							actionListener="#{boletimMedicaoListMB.clear}" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
	</ui:define>
	<ui:define name="filtro">
			<p:fieldset legend="#{messages['filtrar.boletimMedicao']}" toggleable="true" toggleSpeed="500">
				<h:panelGrid columns="2">
					<h:outputLabel value="#{messages['boletimMedicao.label.unidadeOrcamentaria']}: " for="unidadeOrcamentaria" styleClass="text-input" />
					<h:panelGrid columns="5">
						<h:selectOneMenu value="#{boletimMedicaoListMB.unidadeOrcamentaria}" id="unidadeOrcamentaria" style="width: 350px;"
							title="#{messages['boletimMedicao.label.unidadeOrcamentaria']}" 
							requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}">
							<f:selectItem itemLabel="Selecione" itemValue="" />	
	 						<f:selectItems value="#{boletimMedicaoListMB.unidadeOrcamentarias}"></f:selectItems>
						</h:selectOneMenu>
					    <p:message for="unidadeOrcamentaria" />
	
						<h:outputLabel value="#{messages['boletimMedicao.label.obra']}: " for="obra" styleClass="text-input" />
						<h:selectOneMenu value="#{boletimMedicaoListMB.obra}" id="obra" style="width: 550px;"
							title="#{messages['boletimMedicao.label.obra']}" 
							requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}">
							<f:selectItem itemLabel="Selecione" itemValue="" />	
	 						<f:selectItems value="#{boletimMedicaoListMB.obras}"></f:selectItems>
						</h:selectOneMenu>
					    <p:message for="obra" />
					</h:panelGrid>

					<h:outputLabel value="#{messages['boletimMedicao.label.numeroMedicao']}: " for="numeroMedicao" styleClass="text-input" />
					<h:panelGrid columns="2">
						<h:inputText id="numeroMedicao" value="#{boletimMedicaoListMB.numeroMedicao}"
							title="#{messages['aditivo.alt.numeroMedicao']}" />
						<p:message for="numeroMedicao" />
					</h:panelGrid>
				</h:panelGrid>

			    <h:commandButton value="#{messages['button.pesquisar']}"  action="#" ajax="true" >
		    		<f:ajax execute="list" render="list" />
		    	</h:commandButton>

			</p:fieldset>	
	</ui:define>
		
	<ui:define name="colunaMarcacao">
			<p:column style="width:1%;">
				<h:selectBooleanCheckbox value="#{boletimMedicaoListMB.selection[bean.id]}"></h:selectBooleanCheckbox>
			</p:column>
	</ui:define>
	
	
	<ui:define name="colunas">
				

				<p:column style="width:5%;" sortBy="#{bean.id}">
					<f:facet name="header">#{messages['boletimMedicao.label.id']}</f:facet>
					<h:outputText value="#{bean.id}" />
				</p:column>
						
				<p:column sortBy="#{bean.numeroMedicao}">
					<f:facet name="header">#{messages['boletimMedicao.label.numeroMedicao']}</f:facet>
					<h:commandLink action="#{boletimMedicaoListMB.getNextView}" actionListener="#{boletimMedicaoListMB.clear}">
						<h:outputText value="#{bean.numeroMedicao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
						
				<p:column sortBy="#{bean.obra.unidadeOrcamentaria.descricao}">
					<f:facet name="header">#{messages['boletimMedicao.label.unidadeOrcamentaria']}</f:facet>
					<h:commandLink action="#{boletimMedicaoListMB.getNextView}" actionListener="#{boletimMedicaoListMB.clear}">
						<h:outputText value="#{bean.obra.unidadeOrcamentaria.descricao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						

				<p:column sortBy="#{bean.obra.titulo}">
					<f:facet name="header">#{messages['boletimMedicao.label.obra']}</f:facet>
					<h:commandLink action="#{boletimMedicaoListMB.getNextView}" actionListener="#{boletimMedicaoListMB.clear}">
						<h:outputText value="#{bean.obra.titulo}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>

				<p:column sortBy="#{bean.statusPagamento}">
					<f:facet name="header">#{messages['boletimMedicao.label.statusPagamento']}</f:facet>
					<h:commandLink action="#{boletimMedicaoListMB.getNextView}" actionListener="#{boletimMedicaoListMB.clear}">
						<h:outputText value="#{bean.statusPagamento}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.dataBoleim}">
					<f:facet name="header">#{messages['boletimMedicao.label.dataBoleim']}</f:facet>
					<h:commandLink action="#{boletimMedicaoListMB.getNextView}" actionListener="#{boletimMedicaoListMB.clear}">
						<h:outputText value="#{bean.dataBoleim}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.dataInicioMedicao}">
					<f:facet name="header">#{messages['boletimMedicao.label.dataInicioMedicao']}</f:facet>
					<h:commandLink action="#{boletimMedicaoListMB.getNextView}" actionListener="#{boletimMedicaoListMB.clear}">
						<h:outputText value="#{bean.dataInicioMedicao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
						
				<p:column sortBy="#{bean.valorMedicao}">
					<f:facet name="header">#{messages['boletimMedicao.label.valorMedicao']}</f:facet>
					<h:commandLink action="#{boletimMedicaoListMB.getNextView}" actionListener="#{boletimMedicaoListMB.clear}">
						<h:outputText value="#{bean.valorMedicao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>
	</ui:define>
</ui:composition>